package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("video.mp4");
        FileOutputStream fos = new FileOutputStream("copy2.mp4");
        long start = System.currentTimeMillis();
        byte[] bytes=new byte[1024*10];
        int len;
        while ((len=fis.read(bytes))!=-1){
            fos.write(bytes,0,len);
        }
        fos.close();
        fis.close();
        long end = System.currentTimeMillis();
        System.out.println("完成拷贝,共耗时:"+(end-start)+"毫秒");
/*        FileInputStream fis = new FileInputStream("video.mp4");
        FileOutputStream fos = new FileOutputStream("copy2.mp4");
        long start = System.currentTimeMillis();
        byte[] datas = new byte[1024 * 10];
        int len;
        while ((len = fis.read(datas)) != -1) {
            fos.write(datas, 0, len);
        }
        long end = System.currentTimeMillis();
        System.out.println("共耗时:" + (end - start));*/
    }
}
